home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’92 / NetWarmer / source / Startup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-28  |  1.0 KB  |  61 lines  |  [TEXT/KAHL]

  1. /* © 1988, Bowers Development Corp. */
  2. /* Startup.c */
  3.  
  4. #include "Globals.h"
  5. #include "ResourceDefs.h"
  6. #include "EventLoop.h"
  7. #include "FileM.h"
  8. #include "Miscellany.h"    
  9.  
  10. short            finderMessage;
  11. short            nrDocs;
  12.     
  13. /*----------*/
  14. short  main (void);
  15. void PrintDocuments (void);
  16. void OpenDocuments (void);
  17.  
  18. /*----------*/
  19. short main ()
  20. {
  21.     Initialize ();
  22.     CountAppFiles (&finderMessage, &nrDocs);
  23.     if (finderMessage == appPrint) {
  24.         PrintDocuments ();
  25.     } else {
  26.         OpenDocuments ();
  27.         MainLoop ();
  28.     }
  29. } /*Startup*/
  30.  
  31. /*----------*/
  32. void PrintDocuments ()
  33. {
  34.     Acknowledge (CantPrintID);
  35. } /*PrintDocuments*/
  36.  
  37. /*----------*/
  38. void OpenDocuments ()
  39. {
  40.     short            n;
  41.     short            nrOpened;
  42.     AppFile            docInfo;
  43.  
  44.     nrOpened = 0;
  45.     for (n = 1; n <= nrDocs; n++) {
  46.         GetAppFiles (n, &docInfo);
  47.         if (OkToOpen (docInfo.fType)) {
  48.             OpenFile (docInfo.fName, docInfo.vRefNum);
  49.             nrOpened++;
  50.         } else {
  51.             ParamText (docInfo.fName, "", "", "");
  52.             Acknowledge (WrongTypeID);
  53.         }
  54.         ClrAppFiles (n);
  55.     } /*for*/
  56.     if (nrOpened == 0) {
  57.         Open0Files ();
  58.     }
  59. } /*OpenDocuments*/
  60.  
  61.